package com.jintoufs.service.authImg.impl;

import com.google.common.collect.Maps;
import com.jintoufs.dao.auth.AuthImgMapper;
import com.jintoufs.domain.auth.AuthImg;
import com.jintoufs.service.authImg.AuthImgService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class AuthImgServiceImpl implements AuthImgService{

    @Resource
    private AuthImgMapper authImgMapper;
    @Override
    public List<AuthImg> queryByParam(Map<String,Object> param){
       return authImgMapper.queryByParam(param);
    }

    @Override
    public int save(AuthImg authImg, String uuid) {
        if (uuid!=null){
            authImg.setId(uuid);
            return authImgMapper.insertSelective(authImg);
        }else {
            return authImgMapper.updateByPrimaryKeySelective(authImg);
        }
    }

    @Override
    public void deleteWithCustomerIdAndCode(String customerId, String code) {
        Map<String,Object> param = Maps.newHashMap();
        param.put("customerId",customerId);
        param.put("code",code);
        authImgMapper.deleteWithCustomerIdAndCode(param);
    }
}
